home *** CD-ROM | disk | FTP | other *** search
INI File | 1992-09-02 | 7.3 KB | 224 lines |
- [Here's the new EasyGUI! it's still not completely done yet, but way
- more finished than the v3.0a version.]
-
-
- Introducing:
-
-
- E A S Y G U I
-
-
- An interface builder for E, with the following highlights:
-
- - It's totally Font-Sensitive
- - It's Resizable
- - It's Self-Organising, i.e. it arranges gadgets
- - It's more StyleGuide compliant than your granny
- - It's Fast and Flexible
- - It's relatively small, needs no extra external libraries
- - And above all: It's extremely easy to use!!!
-
- Bad Sides:
-
- - It lacks the full power/features of MUI/BGUI/Triton etc.
-
-
-
- EasyGUI takes the form a module file that needs to be included into your
- E source. The most simple form of constructing a GUI consist of calling
- the function easygui() with a (possibly nested) E list which describes
- your GUI. just to show how Easy, try this source:
-
- MODULE 'tools/EasyGUI'
- PROC main() IS easygui('um,...',[BUTTON,0,'Ok!'])
-
- This'll open a window with just one gadget in it, and wait for the
- user to push it. If easygui() can't get what it wants, it'll start
- throwing around exceptions, so we'll probably need an exception
- handler to be able to inform the user properly (see below).
-
- The first arg of easygui() is the window title, the second one is the
- GUI description. The form of these desciptions is quite simple: It's a
- list with as first element the type of gadget, the second is called an
- action value (more later), and the rest is gadget-specific.
-
- To be able to build GUI's outof more components than just one gadget,
- one can group gadgets with a ROW and a COL list:
-
- [COLS,
- [BUTTON,1,'Ok'],
- [BUTTON,0,'Cancel']
- ]
-
- This'll create a new group, consisting of two gadgets next to each other.
- COLS and ROWS groups are like a single gadget, i.e. you can easily put them
- into other groups, to create GUI's of infinite complexity.
-
- Other Grouping functions are EQCOLS and EQCOLS, which try to align gadgets
- in a group.
-
- [BEVEL,a] will put a bevel box around a, whatever it is (a gadget, a group...),
- and BEVELR is the recessed version.
-
- Other elements of groups are mostly gadgets, which have a specific #of
- arguments. [If the number of arguments is incorrect, EasyGUI will raise
- the "Egui" exception.]
-
-
- gadgets:
-
- general format: [NAME,action,text,...]
- in {}: which direction it may resize.
- * = not implemented or things missing.
-
- Each gadget shows the gadget template, explanation, the form of the
- actionfunction (explained below), and a typical example).
-
-
- [BUTTON,action,intext]
- buttonaction(info)
- example: [BUTTON,0,'Cancel']
-
- [CHECK,action,righttext,checkedbool,lefttextbool]
- checkedbool = whether gadget should initially be check-marked
- checkaction(info,checkedbool)
- example: [CHECK,{case},'Ignore case',TRUE,FALSE]
-
- [INTEGER,action,lefttext,num,relsize]
- num = initial value
- integeraction(info,newnum) {x}
- example: [INTEGER,{v},'int:',5,3]
-
- [LISTV,action,textabove,relx,rely,execlist,readbool,selected]
- execlist = ptr to an execlist. (see tools/constructors.m)
- readbool = whether listview is read-only
- *selected = 0=none, 1=read, 2=strgad (fill in 0 for compat.)
- listviewaction(info,num_selected) {x,y}
- [LISTV,0,NIL,5,5,filenamelist,0,NIL]
-
- [MX,action,abovetext,nil_term_elist,lefttextbool]
- mxaction(info,num_selected)
- example: [MX,{v},NIL,['One','Two','Three',NIL],FALSE]
-
- [CYCLE,action,lefttext,nil_term_elist]
- cycleaction(info,num_selected)
- example: [CYCLE,{v},'choose:',['Yep','Nope',NIL]]
-
- [PALETTE,action,lefttext,depth,relx,rely]
- depth = 1..8, number of bitplanes this color is for
- paletteaction(info,colour) {x,y}
- example: [PALETTE,{v},'color:',3,5,2]
-
- [SCROLL,action,isvert,total,top,visible,relsize]
- total = resolution of scroller
- top = current top represented
- visible = current
- scolleraction(info,curtop) {x|y}
- example: [SCROLL,{v},FALSE,10,0,2,2]
-
- [SLIDE,action,lefttext,isvert,min,max,cur,relsize,levelformat]
- min,max = value range of slider
- cur = current value
- levelformat = string that shows levelformat, example '%2ld'. leave
- a large amount of spaces left in lefttext for this.
- slideraction(info,cur) {x|y}
- example: [SLIDE,0,'Colors:',FALSE,1,8,3,5,'']
-
- [STR,action,lefttext,initial,maxchars,relsize]
- initial = initial string contents
- maxchars = max #of chars for string
- stringaction(info,newstring) {x}
- example: [STR,0,'Pattern','#?.e',200,5]
-
- [TEXT,text,lefttext,borderbool,relsize] {x}
- borderbool = whether or not a recessed bevelbox should be placed around 'text'
- example: [TEXT,'Selected Fonts',NIL,FALSE,3]
-
- *[NUM,int,lefttext,borderbool,relsize] {x}
-
- *[RENDER,actionr,actionp,x,y] -> in fontunits
- renderrefresh(x,y,xs,ys)
- renderpress(x,y) -> relative to topcorner
-
- *[RENDERFIXED,actionr,actionp,x,y] -> in pixels
- renderfixedrefresh(x,y)
- renderfixedpress(x,y)
-
- [SBUTTON] {x}
- -> same as button, only now resizes.
-
- [BAR], [SPACE] {x,y}, [SPACEH] {x}, [SPACEV] {y}
- BAR places a nice divider-bar between gadgets/groups. Whether it's
- horizontal or vertical depends on which group it is in. SPACE/SPACEH/SPACEV
- do nothing, they only eats up space. This can be very handy in GUI design,
- they act like a spring between elements (do not use them on the borders of a
- GUI, only in the middle).
-
- See the example GUI's how to use these.
-
- actioncodes:
- - an integer in the range 0..999
- dogui() will close all and exit with this code
- - a ptr to a procedure to perform an action. the type of procedure
- (i.e. #of args) differs with each gadget. After calling the procedure,
- dogui() will normally continue with this gui.
-
- #?text:
- (where #? is left/right etc.): a text to place next to the gadget. often
- is allowed to be NIL.
-
- relsize,relx,rely:
- generally gadgets will automatically get a size depending on a number of
- factors, but relsize allows the programmer to give a minimum size for
- certain gadgets, thereby sizing a whole group. If other gadgets already
- account for the minimum size, this one can safely be set to a low value
- such as 2. All these sizes are calculate in terms of the hight of the font.
-
- nil_term_elist:
- a nil-terminated E list, such as ['One','Two','Three',NIL]
-
- isvert:
- TRUE if gadget needs to be vertical, horizontal by default.
-
-
- exceptions raised:
-
- "MEM" -- no mem
- "GUI" -- for things like CreateGadgetA, OpenWindowTagList etc.
- "GT" -- couldn't open gadtools.library
- "DF" -- same for diskfont
- "bigg" -- for "BIG Gui": interface is calculated to be bigger than the screen.
- generally you should keep gui's small, so that they still fit on
- 640x200 topaz screens. If the user runs Times/30 on this screen, he
- has a problem.
- "Egui" -- a design error: most probably handed over a list to dogui()
- that was either to long or too short
- <other> -- Raise()ed by own function
-
-
- example of usage of other three function (= definition easygui())
-
-
- PROC easygui(windowtitle,gui,info=NIL,screen=NIL,textattr=NIL) HANDLE
- DEF gh=NIL:PTR TO guihandle,res=-1
- gh:=guiinit(windowtitle,gui,info,screen,textattr)
- WHILE res<0
- Wait(gh.sig)
- res:=guimessage(gh)
- ENDWHILE
- EXCEPT DO
- cleangui(gh)
- IF exception THEN ReThrow()
- ENDPROC res
-
-
- General advice: try out the examples. Sometimes something won't work, but
- EasyGUI is flexible enough that at least one way of arranging groups etc.
- will give you a nice GUI :-). If you need more power than EasyGUI currently
- gives, you'll have to use MUI/BGUI/Triton/WhatEver instead.
-
-
-
- biggest known bugs:
- - sets gadgets to origanal values on resize (!).
-